package com.hellobike.haxing.modules.product.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import com.hellobike.haxing.modules.product.entity.City;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

/**
 * @Description: 城市
 * @Author: haxing-boot
 * @Date:   2020-02-03
 * @Version: V1.0
 */
public interface CityMapper extends BaseMapper<City> {

    @Select("SELECT id, name, province_id FROM t_city WHERE province_id=#{provinceId} AND EXISTS (SELECT 1 FROM t_shop WHERE city_id=t_city.id AND deleted=0)")
    List<City> getOpenedCitiesByProvinceId(@Param("provinceId") Long provinceId);

    List<City> getOpenedCitiesByProvinceIds(@Param("provinceIdList") List<Long> provinceIdList);

    List<City> getAllOpenedCities();
}
